package com.tl.sboot.web;

import java.util.Map;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tl.sboot.service.RedisService;
import com.tl.sboot.utils.RedisUtil;

@Controller
public class RedisController {
	@Autowired
	RedisService redisService;
	@Autowired
	RedisUtil ru;
	
	/**
	 * 测试redis添加用户
	 * @return
	 */
	@RequestMapping(value="setUserRedis")
	@ResponseBody
	public String setUserRedis(){
		String set = ru.set("cjw", "chenjunwen");
		return set;
	}
	/**
	 * 获取数据
	 * @return
	 */
	@RequestMapping(value="getA_Stock")
	@ResponseBody
	public Set<String> getA_Stock(){
		return ru.zrange("SS.QUANT.DKBF.20161124.SSE.A_STOCK", 0, -1);
	}
	/**
	 * 添加数据
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="addSCPRedis")
	public Map<String, String> findSTK_COM_PROFILE() {
		Map<String, String> scpMap = redisService.findSTK_COM_PROFILE();
		return scpMap;
	}
	/**
	 * 获取这个表所有字段的count
	 * @return
	 */
	@RequestMapping(value="findCountCvs")
	@ResponseBody
	public Map<String, Long> findSTK_CASH_GENC_Count() {
		redisService.findSTK_BALA_GENB_Count();
		redisService.findSTK_INCOME_GENP_Count();
		return redisService.findSTK_CASH_GENC_Count();
	}
}
